package dk.modified.reshary;

import java.util.ArrayList;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.widget.ImageView;

public class ImageAdapter extends FragmentPagerAdapter {

	private int actionBarHeight;
	private int bottomBarHeight;

	private onSetBottomBarHidden mOnSetBottomBarHidden;

	private Context c;
	private ArrayList<Owners> data;
	private ViewPagerFragment fragment;

	@Override
	public Fragment getItem(int index) {
		fragment = ViewPagerFragment.newInstance(data.get(index), actionBarHeight, bottomBarHeight);
		fragment.setOnBottomBarHiddenListener(new onSetBottomBarHidden() {
			
			@Override
			public void show() {
				// TODO Auto-generated method stub
				mOnSetBottomBarHidden.show();
			}
			
			@Override
			public void hide() {
				mOnSetBottomBarHidden.hide();
			}
		});
		
		return fragment;
	}

	public ImageAdapter(Context c, ArrayList<Owners> data, int actionBarHeight,
			FragmentManager fm) {
		super(fm);
		this.c = c;
		this.data = data;
		this.actionBarHeight = actionBarHeight;

	}

	@Override
	public int getCount() {
		return data.size();
	}

	

	public void setOnBottomBarHiddenListener(onSetBottomBarHidden listener) {
		mOnSetBottomBarHidden = listener;
	}
}
